<html>
  <head>
    <title>网络设备扫描</title>
    <!-- 引入Bootstrap CSS -->
    <link rel="stylesheet" href="./网络设备扫描.css" />
    <!-- 引入Bootstrap JS 和 Popper.js (Bootstrap的依赖) -->
  </head>

  <body style="overflow: hidden">
    <form method="post">
      <input
        type="text"
        name="subnet"
        value="192.168.8.0/24"
        placeholder="e.g. 192.168.1.0/24"
        required="" />
      <input type="submit" value="扫描" />
    </form>
    <div class="modal-backdrop" id="modalBackdrop" style="display: block"></div>
    <div
      id="modalContainer"
      class="modal-container"
      style="display: block; opacity: 0">
      <div class="modal-close" id="closeModal"></div>
      <div class="modal-content">
        <h5 class="modal-title" id="myModalLabel">
          请输入IP为：192.168.8.135的设备的登录信息
        </h5>
        <div class="modal-body">
          <form id="myForm">
            <!-- 表单 -->
            <input type="hidden" id="iptext" ,name="iptext" />
            <input type="hidden" id="netType" ,name="netType" value="0" />
            用户名: <input type="text" id="name" name="name" /><br />
            密码:
            <input
              type="password"
              class="form-control password"
              autocomplete="off"
              id="pwd"
              name="pwd" /><br />
            <div id="netDevice" style="display: none">
              <h5>请输入 SNMP community（如 public）：</h5>
              <input
                type="text"
                name="community"
                id="community"
                value="public" /><br />
              <h5>Zabbix Server：</h5>
              <input
                type="text"
                id="zabbixServer"
                name="zabbixServer"
                placeholder="请输入 Zabbix Server地址" /><br />

              <div class="radio-group">
                <h5>连接方式</h5>
                <label>
                  <input type="radio" name="protocol" value="ssh" checked="" />
                  <span class="custom-radio"></span>
                  SSH
                </label>
                <label>
                  <input type="radio" name="protocol" value="telnet" />
                  <span class="custom-radio"></span>
                  telnet
                </label>
              </div>
            </div>
          </form>
        </div>
        <div class="modal-footer">
          <button class="modal-btn btn-cancel" id="cancelBtn">取消</button>
          <button class="modal-btn btn-confirm" id="confirmBtn">确定</button>
        </div>
      </div>
    </div>

    <h3 style="text-align: center; font-size: 25px;">扫描结果</h3>
    <table class="list-table" cellpadding="5">
      <tbody>
        <tr>
          <th>IP</th>
          <th>类型</th>
          <th>MAC地址</th>
          <th>厂商</th>
          <th>状态</th>
          <th>登录</th>
        </tr>
        <tr>
          <td>192.168.8.1</td>
          <td>windows</td>
          <td>N/A</td>
          <td>Unknown</td>
          <td>up</td>
          <td><button onclick="showWindowsLoginTip()" class="btn-link">登录</button></td>
        </tr>
        <tr>
          <td>192.168.8.129</td>
          <td>linux</td>
          <td>N/A</td>
          <td>Unknown</td>
          <td>up</td>
          <td>
            <button class="install" data-ip="192.168.8.129" data-type="0">
              登录
            </button>
          </td>
        </tr>
        <tr>
          <td>192.168.8.135</td>
          <td>linux</td>
          <td>N/A</td>
          <td>Unknown</td>
          <td>up</td>
          <td>
            <button class="install" data-ip="192.168.8.135" data-type="0">
              登录
            </button>
          </td>
        </tr>
      </tbody>
    </table>
  </body>
</html>

<script>
  const closeModal = document.querySelector('#closeModal');
  const modalBackdrop = document.querySelector('#modalBackdrop');
  const modalContainer = document.querySelector('#modalContainer');
  closeModal.addEventListener('click', () => {
    modalBackdrop.style.display = 'none';
    modalContainer.style.display = 'none';
  });
</script>
